package com.blb.javatest01.controller;

import com.blb.javatest01.entity.Goods;
import com.blb.javatest01.entity.ResponseResult;
import com.blb.javatest01.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenheng
 * @since 2023-11-20
 */
@CrossOrigin
@RestController
public class GoodsController {

    @Autowired
    private IGoodsService goodsService;

    @GetMapping("/goods")
    public ResponseResult<List<Goods>> getGoods(){
        List<Goods> list = goodsService.list();
        return ResponseResult.ok(list);
    }
}
